<include file="../Public/header" />

	<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/layout.css" />
 <link href="__PUBLIC__/themes/blue/layout.css" rel="stylesheet" type="text/css" />
</head>


<script type="text/javascript" src="__PUBLIC__/js/tbox/tbox.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/admin.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-admin-box.js"></script>

<script>
	// tbox用常量
	var THEME = "__THEME__";
	var APP    = "__APP__";
	var URL    = "__URL__";
	var PUBLIC = "../Public";
	var SITE_URL = "{*SITE_URL}";
</script>

<body>
<div>
	<!-- 顶部tab BEGIN -->
	<div class="tab">
		<ul>
			<li><a href="{:U('admin/System/attach')}" <eq name="ACTION_NAME" value="attach">class="on"</eq>>附件管理</a></li>
			<li><a href="{:U('admin/System/attach_recycle')}" <eq name="ACTION_NAME" value="attach_recycle">class="on"</eq>>回收站</a></li>
		</ul>
	</div>
	<!-- 顶部tab END -->
	
	<!-- 正文 BEGIN -->
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder" id="checkList">
		<tbody>
			<tr class="top">
				<td class="border" colspan="10"></td>
			</tr>

			<!-- 列表标题 -->
			<tr>
				<th class="header" colspan="10"> 回收站列表 </th>
			</tr>

			<!-- 列表字段 -->
			<tr class="label cell">
				<th>&nbsp;</th>
				<th>ID</th>
				<th>名称</th>
				<th>上传者</th>
				<th>更新时间</th>
				<th>下载量</th>
				<th>应用类型</th>
				<th>扩展名</th>
				<th>大小[字节]</th>
				<th>是否私有</th>
			</tr>
			
			<!-- 列表数据 -->
			<volist name="data" id='vo'>
			<tr id="list_{$vo.id}" class="cell">
				<td><label><input type="checkbox" class="attach_admin_check" rel="0" dataId="{$vo['id']}"></label></td>
				<td>{$vo.id}</td>
				<td><a href="{:U('admin/System/downloadAttach',array('id'=>$vo['id']))}" target="_blank">{$vo.name}</a></td>
				<td><a href="{:U('space/View/index',array('uid'=>$vo['uid']))}" target="_blank">{$vo.uid|getUserName}</a></td>
				<td>{$vo.mtime}</td>
				<td>{$vo.totaldowns}</td>
				<td>{$vo.attach_type}</td>
				<td>{$vo.extension}</td>
				<td>{$vo.size}</td>
				<td><eq name="vo.private" value="1">是<else/>否</eq></td>
			</tr>
			</volist>

			<tr>
				<td class="footer" colspan="10">
					<!--
					<button type="button" onclick="checkall('checkList',true)">全选</button>
					<button type="button" onclick="checkall('checkList',false)">全不选</button>
					<button type="button" onclick="javascript:del('0','__URL__&act=deleteAsk')">删除</button>
					-->
				</td>
			</tr>

			<tr>
				<td class="footer" colspan="10">{$html}</td>
			</tr>

			<tr class="bottom">
				<td class="border" colspan="10"></td>
			</tr>

		</tbody>
	</table>
	<!-- 正文 END -->

</div>

<!-- 前台管理 BEGIN -->
<div id="attach_admin" style="display:none;">
	<a href="javascript:void(0)" onclick="revertAttach()">还原附件</a>
</div>
<!-- 前台管理 END -->

<!-- 页面JS BEGIN -->
<script type="text/javascript">
	//加载前台管理工具
	$(function(){
		$.fn.admin({
			prefix:'attach_',
			checkClass:'attach_admin_check',
			hiddenId:'attach_admin',
			lMinOffset:1,
			type:false,
			position:'right'
		});
	});

	//还原附件
	function revertAttach() {		
		if(confirm('确认要将所选附件还原吗？')){
			$.post("{:U('admin/System/doRevertAttach')}", {id:$.fn.getData('attach_')}, function(result){
				if(result == 1) {
					$.tbox.yes('还原成功',"提示");
					setTimeout("$.tbox.close()",1500);
					$.each($.fn.getData('attach_'),function(i,n){
						$("#list_"+n).remove();
					});
					$('#attach_admin_box').hide();
				}else if(result == 1){
					$.tbox.no('还原失败',"提示");
					setTimeout("$.tbox.close()",1500);
				}
			});
		}
	}
</script>
<!-- 页面JS END -->

</body>
</html>
